export const getUniqueListByKey = (arr, key, needKey) => {
	const result = [];
	const map = new Map();
	if (needKey) {
		arr.sort((a, b) => {
			if (a[needKey]) return -1;
			if (b[needKey]) return 1;
		});
	}

	for (const item of arr) {
		if (!map.has(item[key])) {
			map.set(item[key], true); // set any value to Map
			result.push(item);
		}
	}
	return result;
};
